package com.weishuang.monitor.employee;

import cn.hutool.cron.CronUtil;
import cn.hutool.setting.Setting;
import com.weishuang.monitor.employee.config.ConfigParame;

public class Main {

    private static String cronConfigFile = "cron.setting";

    private static String configFile = "config.setting";

    /**
     * 启动程序
     * @param args
     */
    public static void main(String[] args) {
        //获取接收参数
        if (args != null && args.length > 0) {
            for (String arg : args) {
                if (arg.indexOf("cronConfigFile") == 0) {
                    cronConfigFile = arg.replaceFirst("cronConfigFile=", "");
                }
                if (arg.indexOf("configFile") == 0) {
                    configFile = arg.replaceFirst("configFile=", "");
                }
            }
        }
        //加载配置信息
        Setting setting = new Setting(configFile,Setting.DEFAULT_CHARSET, false);
        ConfigParame.initParame(setting);
        //开始定时任务执行
        CronUtil.setMatchSecond(true);
        CronUtil.setCronSetting(cronConfigFile);
        CronUtil.start();
    }
}
